package oop1.Task1;
/*
百钱买百鸡问题：
100文钱，买一百只鸡，大公鸡5文一只，母鸡3文一只，小鸡苗1文3只
总共多少种买法。。。
 */
public class BuyChicken {
    public static void main(String[] args) {
        int count = 0;
        for (int i = 0; i < 20; i++) {
            for (int j = 0; j < 33; j++) {
                for (int k = 0; k < 100; k += 3) {
                    if ((5 * i + 3 * j + k / 3) == 100 && (i + j + k == 100)) {
                        count++;
                        System.out.println(i + "只公鸡," + j + "只母鸡," + k + "小鸡苗");
                    }
                }
            }
        }
        System.out.println("\n共有" + count + "种买法");
    }
}
